package cn.lsnu.common.sys.service;

import cn.lsnu.common.interfacetools.interfaceentity.Page;
import cn.lsnu.common.interfacetools.interfaceservice.BaseService;
import cn.lsnu.common.sys.entity.MenuEntity;
import cn.lsnu.common.sys.mapper.MenuMapper;
import cn.lsnu.utils.Guuid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MenuService extends BaseService<MenuEntity,MenuMapper>{

    @Autowired
    private MenuMapper menuMapper;

    @Override
    public List<MenuEntity> findList(MenuEntity entity) throws Exception {

        return super.findList(entity);
    }

    @Override
    public Page<MenuEntity> findPage(MenuEntity entity) throws Exception {
        entity.setMenuId(Guuid.uuid());
        return super.findPage(entity);
    }

    @Override
    public void delete(MenuEntity entity) throws Exception {
        super.delete(entity);
    }

    @Override
    public void update(MenuEntity entity) throws Exception {
        super.update(entity);
    }

    @Override
    public void save(MenuEntity entity) throws Exception {
        entity.setMenuId(Guuid.uuid());
        super.save(entity);
    }

    @Override
    public MenuEntity get(String key) throws Exception {
        return super.get(key);
    }

    @Override
    public MenuEntity getEntity(MenuEntity entity) throws Exception {
        return super.getEntity(entity);
    }

    public List<MenuEntity> findLoginMenu(MenuEntity entity) throws Exception {
        return menuMapper.findLoginMenu(entity);
    }

    public void saveInterfacer(MenuEntity entity) throws Exception{
        entity.setMenuId(Guuid.uuid());
        menuMapper.saveInterfacer(entity);
    }

    public void updateInterfacer(MenuEntity entity) throws Exception{
        menuMapper.updateInterfacer(entity);
    }

    public MenuEntity getPageMenu(MenuEntity entity)throws  Exception{

        return menuMapper.getPageMenu(entity);
    }
}
